package com.cgw.room.util;

import android.util.Log;

import java.io.File;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.Executor;
import java.util.concurrent.Executors;

public class Util {
    private static final String TAG = Util.class.getSimpleName();
    public static final Executor EXECUTOR = Executors.newCachedThreadPool();

    public static void mkdirs(String filePath) {
        Log.d(TAG, "mkdirs: " + filePath);
        File f = new File(filePath);
        if (!f.exists()){
            boolean mk = f.mkdirs();
            Log.d(TAG, "mkdirs: " + mk);
        }else{
            Log.d(TAG, "dir existed.  ");
        }
    }

    public static String getDateStr(Date date, String format) {
        if (format == null || format.isEmpty()) {
            format = "yyyy-MM-dd-HH-mm-ss";
        }
        SimpleDateFormat formatter = new SimpleDateFormat(format);
        return formatter.format(date);
    }
}
